package round79;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * User: Samuel
 * Date: 08-03-11
 * Time: 02:58 PM
 */
public class B {
    public static void main(String[] args) throws IOException {
        new B().solve();
    }

    private void solve() throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String num = in.readLine();
        if (num.length() == 1) {
            System.out.println(0);
            System.exit(0);
        }
        int count = 1;
        int sum = 0;
        for (int i = 0; i < num.length(); i++) {
            sum += num.charAt(i) - '0';
        }
        while (numDigits(sum) > 1) {
            int temp = 0;
            while (sum > 0) {
                temp += sum % 10;
                sum = sum / 10;
            }
            sum = temp;
            count++;
        }
        System.out.println(count);
    }

    private int numDigits(int n) {
        return ((int) Math.log10(n)) + 1;
    }
}
